{#
Copyright (c) 2020 Andy Zhou
MIT License
#}
{% extends 'base.html' %}
{% block page_content %}
    <div class="nav nav-pills" role="tablist">
        <a class="nav-item nav-link {% if request.args.get('filter') != 'unread' %}active{% endif %}"
           href="{{ url_for('notification.show', filter='all') }}">
           <i class="bi-inbox"></i>
           {{ _("All") }}
        </a>
        <form method="POST" action="{{ url_for('notification.read_all') }}">
            <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
            <button class="btn btn-sm btn-light">
                <i class="bi-envelope-open-fill"></i>
                {{ _("Mark all as read") }}
            </button>
        </form>
    </div>
    <ul class="list-group">
        {% for notification in notifications %}
            <li class="list-group-item d-flex">
                <div class="p-2 flex-grow-1">
                    {{ _(notification.message) | safe }}
                </div>
                <form class="form-inline p-1" method="POST" action="{{ url_for('notification.read', id=notification.id) }}">
                    <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
                    <button class="btn btn-sm btn-light">
                        <i class="bi-envelope-open"></i>
                        {{ _("Mark as read") }}
                    </button>
                </form>
            </li>
        {% endfor %}
    </ul>
{% endblock %}